<template>
  <div>
    <div class="item_box">
      <p class="title_1 mb10">概要信息</p>
      <SummaryInfo />
    </div>
    <div class="item_box">
      <p class="title_1 mb10">基本信息</p>
      <DetailForm :dataSources="projectData" :columns="baseColumns">
        <template #esgProject="{ formItem }">
          {{ formItem.esgProject == 0 ? '否' : '是' }}
        </template>
        <template #fileList>
          <span
            v-for="item in projectData.fileList"
            class="form_link_Btn"
            :key="item.id"
            >{{ item.name }}</span
          >
        </template>
      </DetailForm>
    </div>
    <div class="item_box">
      <p class="title_1 mb10">项目要素</p>
      <DetailForm :dataSources="projectData" :columns="projectElements" />
    </div>
    <div class="item_box flex_c">
      <p class="title_1">审批进度</p>
      <el-button class="ml10" @click="approvalHistoryVisible=true" type="primary" plain>审批进度查看</el-button>
    </div>
    <div class="item_box">
      <p class="title_1 mb10">业务联络</p>
      <p class="item_box_c_title">司内联系人</p>
      <div class="item_box_c mb10">
        <DetailForm
          :dataSources="item"
          :columns="snColumns"
          v-for="(item, index) in snContactsArr"
          :key="index + 'snContacts'"
        />
      </div>
      <p class="item_box_c_title">客户联系人</p>
      <div class="item_box_c mb10">
        <DetailForm
          :dataSources="item"
          :columns="custColumns"
          v-for="(item, index) in custContactsArr"
          :key="index + 'snContacts'"
        />
      </div>
    </div>
    <ApprovalHistoryDialog v-model="approvalHistoryVisible"/>
  </div>
</template>
  
<script setup>
import ApprovalHistoryDialog from "./components/ApprovalHistoryDialog.vue";
import SummaryInfo from "@/components/SummaryInfo.vue";
import { reactive, ref } from "vue";

const props = defineProps({
  pageType: {
    type: String,
    default: false,
  },
});

// 基本信息
const baseColumns = ref([
  { label: "商机号", column: "buseoppCode", span: 8 },
  { label: "商机名称", column: "projectName", span: 8 },
  { label: "项目名称", column: "name", span: 8 },
  { label: "商机分类", column: "projectTypeName", span: 8 },
  { label: "项目年度开始时间", column: "projectStartDate", span: 8 },
  { label: "项目年度结束时间", column: "projectEndDate", span: 8 },
  { label: "是否总公司投标", column: "isQuoteStr", span: 8 },
  { label: "本年度保费规模（万元）", column: "clientPremiumScope", span: 8 },
  { label: "投标日期", column: "bidDate", span: 8 },
  { label: "新保/续保", column: "premiumTypeStr", span: 8 },
  { label: "与我司合作历史", column: "coopHistory", span: 8 },
  { label: "合作关系评估", column: "crAssessmentStr", span: 8 },
  { label: "经纪公司", column: "eonomicCompany", span: 8 },
  { label: "客户预算（万元）", column: "clientBudget", span: 8 },
  { label: "客户期望安排方式", column: "clientExpectWayStr", span: 8 },
  { label: "商机创建人", column: "createName", span: 8 },
  { label: "申请分公司", column: "createBranchName", span: 8 },
  { label: "总部管理处室", column: "createSectionName", span: 8 },
  { label: "是否ESG项目", column: "esgProject", slot: "esgProject", span: 24 },
  { label: "其他参与公司", column: "aaotherCompanyaaaa", span: 24 },
  { label: "项目概况简介", column: "projectInfo", span: 24 },
  { label: "竞争对手现状", column: "otherCompanyCondition", span: 24 },
  { label: "我司目标与策略", column: "goal", span: 24 },
  { label: "附件", column: "fileList", slot: "fileList", span: 24 },
]);
// 项目要素
const projectElements = ref([
  { label: "预计保额（万元）", column: "predictCoverage", span: 8 },
  { label: "预计总保费（万元）", column: "predictPremium", span: 8 },
  { label: "目标保费（万元）", column: "targetPremium", span: 8 },
  { label: "目标份额（%）", column: "targetShare", span: 8 },
  { label: "预计报价/谈判日期", column: "predictDate", span: 8 },
  { label: "历史损失记录（万元）", column: "historyLose", span: 8 },
  { label: "涉及险种", column: "predictClasscode", span: 24, toHtml: true },
  { label: "业务渠道", column: "channelStr", span: 8 },
  { label: "预计分出比例（%）", column: "predictScale", span: 8 },
  { label: "预计分出金额（万元）", column: "predictAmount", span: 8 },
  { label: "备注", column: "remark", span: 24 },
]);
// 表单数据
const data = {
  buseoppId: 211401,
  buseoppCode: "OP202407190001",
  clientId: 3776,
  projectName: "2022-2024武汉东湖高新某某投标项目2023-2024年",
  isQuote: "1",
  isQuoteStr: "是",
  clientPremiumScope: "100.00",
  clientCompensateRate: null,
  premiumType: "0",
  premiumTypeStr: "新保商机",
  coopHistory: "项目1，项目2，项目3",
  crAssessment: "0",
  crAssessmentStr: "好",
  clientBudget: "100.00",
  clientExpectWay: "1",
  clientExpectWayStr: "共保",
  clientExpectPerson: null,
  clientExpectCompany: null,
  bidDate: "2022-06-16",
  projectInfo: "2022-2024武汉东湖高新某某投标项目",
  otherCompany: "苏州市轨道交通2号线有限公司",
  otherCompanyCondition: "竞标中",
  goal: "高效完成",
  predictCoverage: "10000.00",
  predictPremium: "100.00",
  predictShare: null,
  targetPremium: "100.00",
  targetShare: "100.00",
  predictDate: "2022-07-29",
  historyLose: "10",
  predictClasscode: "企业财产险,家庭财产险,工程险,货物运输保险",
  predictClasscodeArr: null,
  channel: "0",
  channelStr: "经纪",
  predictScale: "1.00",
  predictAmount: "1.00",
  isOverseas: null,
  overseasType: null,
  isBeltroad: null,
  targetContinent: null,
  targetCountry: null,
  remark: "暂无。。。",
  buseoppStateStr: null,
  buseoppState: "0",
  createId: 1,
  createName: "admin",
  createTime: "2024-07-19 16:32:05",
  updateTime: "2024-07-19 16:32:05",
  custId: "6ED3E1071D380EA58C201118",
  clientName: "苏州市轨道交通集团有限公司",
  certType: "1",
  certTypeName: "统一社会信用代码",
  certNo: "91320500596945370W",
  eonomicCompany: "中铁十七局集团有限公司",
  eonomicCustId: "AA51E93556D8111E55201123",
  targetUserDOS: [
    {
      id: 201255,
      buseoppId: 211401,
      userId: 20297,
      userName: null,
      teamCode: null,
      teamName: null,
      userDuty: null,
      userLabel: null,
      userLabelName: null,
      userLabels: null,
      userContent: null,
      userRemark: null,
      positionname: "员工",
      officePhone: null,
      mobilPhone: "12325874566",
      fax: null,
      outEmail: "wanglili-060@cpic.com.cn",
      userRole: null,
      userRoleName: null,
      empDepartId: 1050334,
      empDepartName: "发展企划部",
      empDepartGroupId: 2067,
      empDepartGroupName: null,
      empBranchId: 1,
      empBranchName: null,
      empId: 1243517,
      personalId: 20,
      empName: "王丽丽",
      userAreacode: null,
      userPhone: null,
      userMobile: null,
      userFax: null,
      userMail: null,
      source: null,
      status: null,
      createId: null,
      updateId: null,
      createTime: null,
      updateTime: null,
    },
    {
      id: 201256,
      buseoppId: 211401,
      userId: 6,
      userName: null,
      teamCode: null,
      teamName: null,
      userDuty: null,
      userLabel: null,
      userLabelName: null,
      userLabels: null,
      userContent: null,
      userRemark: null,
      positionname: "正式",
      officePhone: "",
      mobilPhone: "13701602299",
      fax: "",
      outEmail: "wangj@cpic.com.cn",
      userRole: null,
      userRoleName: null,
      empDepartId: 1733355,
      empDepartName: "纪检监察室",
      empDepartGroupId: 2067,
      empDepartGroupName: null,
      empBranchId: 1,
      empBranchName: null,
      empId: 736213,
      personalId: 19,
      empName: "王捷",
      userAreacode: null,
      userPhone: null,
      userMobile: null,
      userFax: null,
      userMail: null,
      source: null,
      status: null,
      createId: null,
      updateId: null,
      createTime: null,
      updateTime: null,
    },
  ],
  linkmanVOS: [
    {
      linkmanId: 50118,
      custId: null,
      clientId: null,
      clientName: null,
      certType: null,
      certTypeName: null,
      certNo: null,
      linkmanName: "新增联系人001",
      linkmanDept: null,
      linkmanTitle: null,
      linkmanPhone: null,
      linkmanMobile: "13900000001",
      linkmanFax: null,
      linkmanMail: null,
      linkmanBrief: null,
      createName: null,
      personId: null,
      accountCityId: null,
      source: null,
      status: null,
      createId: 1,
      updateId: null,
      createTime: "2021-02-25 21:02:30",
      updateTime: null,
    },
    {
      linkmanId: 50119,
      custId: null,
      clientId: null,
      clientName: null,
      certType: null,
      certTypeName: null,
      certNo: null,
      linkmanName: "新增联系人002",
      linkmanDept: null,
      linkmanTitle: null,
      linkmanPhone: null,
      linkmanMobile: "13900000002",
      linkmanFax: null,
      linkmanMail: null,
      linkmanBrief: null,
      createName: null,
      personId: null,
      accountCityId: null,
      source: null,
      status: null,
      createId: 1,
      updateId: null,
      createTime: "2021-02-25 21:02:30",
      updateTime: null,
    },
    {
      linkmanId: 50499,
      custId: null,
      clientId: null,
      clientName: null,
      certType: null,
      certTypeName: null,
      certNo: null,
      linkmanName: "张三",
      linkmanDept: "",
      linkmanTitle: "",
      linkmanPhone: "",
      linkmanMobile: "16790901212",
      linkmanFax: "",
      linkmanMail: "",
      linkmanBrief: null,
      createName: null,
      personId: null,
      accountCityId: null,
      source: null,
      status: null,
      createId: 1,
      updateId: null,
      createTime: "2023-12-29 15:35:16",
      updateTime: null,
    },
  ],
  brokerDOS: [],
  fileInfoVOList: [
    {
      id: 1008580,
      name: "getProfileInfo.doc",
      url: null,
      createTime: "2024-07-19 16:30:20",
      updateTime: "2024-07-19 16:32:07",
      fileType: "Default",
    },
  ],
  createSectionId: 10,
  createSectionName: "团车业务部",
  processInstanceId: null,
  processState: null,
  processEndTime: null,
  createOrgId: 1,
  createBranchId: 1,
  createOrgName: null,
  createBranchName: "总公司",
  name: "2022-2024武汉东湖高新某某投标项目",
  projectType: "1",
  projectTypeName: "可续保商机",
  projectStartDate: 2023,
  projectEndDate: 2024,
  esgProject: 1,
};
const { fileInfoVOList, targetUserDOS, linkmanVOS, ...res } = data
const projectData = reactive({
  fileList: fileInfoVOList,
  ...res
});
// 司内联系人
const snContactsArr = targetUserDOS
const snColumns = ref([
  { label: "联系人姓名", column: "empName", span: 8 },
  { label: "所属部门", column: "empDepartName", span: 8 },
  { label: "职务", column: "positionname", span: 8 },
  { label: "电话", column: "officePhone", span: 8 },
  { label: "手机", column: "mobilPhone", span: 8 },
  { label: "传真", column: "fax", span: 8 },
  { label: "邮箱地址", column: "outEmail", span: 8 },
  { label: "团队角色", column: "userRoleName", span: 8 },
  { label: "项目角色", column: "teamName", span: 8 },
]);
// 客户联系人
const custContactsArr = linkmanVOS
const custColumns = ref([
  { label: "联系人姓名", column: "linkmanName", span: 8 },
  { label: "手机", column: "linkmanMobile", span: 8 },
  { label: "邮箱地址", column: "linkmanMail", span: 8 },
  { label: "所属部门", column: "linkmanDept", span: 8 },
  { label: "职务", column: "linkmanTitle", span: 8 },
  { label: "电话", column: "linkmanPhone", span: 8 },
  { label: "传真", column: "linkmanFax", span: 24 },
]);

// 审批历史
const approvalHistoryVisible = ref(false)
</script>

<style lang="scss" scoped>
.title_1 {
  margin: 10px;
  margin-left: 0;
}
</style>